<%@ page import="com.ama.utils.SpringUtils" %>
<%@ page import="com.ama.service.EstateService" %>
<%@ page import="com.ama.service.BuildService" %>
<%@ page import="com.ama.service.RoomService" %>
<%@ page import="com.ama.pojo.*" %>
<%@ page import="java.util.Date" %>
<%@ page import="com.ama.utils.DateUtil" %>
<%@ page import="com.ama.utils.NumberUtils" %>
<%@ page import="com.ama.service.PropertyService" %>
<%@ page import="com.ama.service.impl.*" %>
<%@ page import="com.ama.utils.GetNumber" %>
<%@ page import="com.ama.dao.ApplyDao" %><%--
  Created by IntelliJ IDEA.
  User: AMAZZED
  Date: 2020/12/19
  Time: 14:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
    <title>申请单</title>
    <link rel="icon" href="favicon.ico" type="image/ico">
    <meta name="keywords" content="LightYear,光年,后台模板,后台管理系统,光年HTML模板">
    <meta name="description" content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">
    <meta name="author" content="yinqi">
    <link href="../css/bootstrap.min.css" rel="stylesheet">
    <link href="../css/materialdesignicons.min.css" rel="stylesheet">
    <link href="../css/style.min.css" rel="stylesheet">
    <style type="text/css">
        input[readonly],
        .form-control[readonly]{
            background-color: #FFFFFF;
        }
    </style>
</head>

<%
    ApplyDao applyDao = SpringUtils.getBean(ApplyDao.class);
    Staff staff = (Staff)session.getAttribute("user");
    Long applyId = Long.valueOf(request.getParameter("applyId"));
    System.out.println(applyId+"**********************************************************************");
    Apply apply = applyDao.selectByPrimaryKey(applyId);
    Long bedId = apply.getBedId();
    System.out.println(bedId+"**********************************************************************");
    BedServiceImpl bedService = SpringUtils.getBean(BedServiceImpl.class);
    EstateService estateService = SpringUtils.getBean(EstateServiceImpl.class);
    BuildService buildService = SpringUtils.getBean(BuildServiceImpl.class);
    RoomService roomService = SpringUtils.getBean(RoomServiceImpl.class);
    PropertyService propertyService = SpringUtils.getBean(PropertyServiceImpl.class);



    Bed bed = bedService.selectById(bedId);
    Estate estate = estateService.selectById(bed.getEstateId());
    Build build = buildService.selectById(bed.getBuildId());
    Room room = roomService.selectById(bed.getRoomId());
    Property property = propertyService.selectById(estate.getPropertyId());

    String applyNum =apply.getApplyNum() ;

    String date = DateUtil.getStringDateShort();

    double cost = NumberUtils.round(room.getRoomRentarea()*room.getRoomPrice() + room.getRoomPublicarea()*1 ,2);

%>

<body>
<div class="container-fluid p-t-15">

    <div class="row">
        <div class="col-lg-12">
            <div class="card">

                <div class="card-body">

                    <form action="#" method="post" class="guide-box" data-navigateable="true">

                        <hr>


                        <div class=" text-center m-b-10"><h4>员工宿舍申请单</h4></div>
                        <div class="row m-b-10">
                            <div class="col-lg-12">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">申请编号</button>
                                    </span>
                                    <input name="applyNum" type="text" class="form-control" readonly value="<%=applyNum%>">
                                </div>
                            </div>
                        </div>

                        <div class="row m-b-10">
                            <div class="col-lg-6 m-b-10">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">申请日期</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=date%>">
                                </div>
                            </div>

                            <div class="col-lg-6">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">申请员工</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=staff.getStaffName()%>">
                                </div>
                            </div>
                        </div>

                        <div class="row m-b-10">
                            <div class="col-lg-6">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">小区名称</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=estate.getEstateName()%>">
                                </div>
                            </div>

                        </div>
                        <div class="row m-b-10">
                            <div class="col-lg-6">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">楼栋名称</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=build.getBuildName()%>">
                                </div>
                            </div>
                        </div>



                        <div class="row m-b-10">
                            <div class="col-lg-6">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">房间名称</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=room.getRoomName()%>">
                                </div>
                            </div>
                        </div>

                        <div class="row m-b-10">
                            <div class="col-lg-6">
                                <div class="input-group">
                                <span class="input-group-btn">
                                  <button class="btn btn-default" type="button">铺位名称</button>
                                </span>
                                    <input type="text" class="form-control" readonly value="<%=bed.getBedName()%>">
                                </div>
                            </div>
                        </div>

                        <div class="row m-b-10">
                            <div class="col-lg-4 m-b-10">
                                <div class="input-group ">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">手机号</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=staff.getStaffPhone()%>">
                                </div>
                            </div>
                            <div class="col-lg-4 m-b-10">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">学历</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=staff.getEducation()%>">
                                </div>
                            </div>
                            <div class="col-lg-4">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">入行时间</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=DateUtil.dateToStr(staff.getEntrytime())%>">
                                </div>
                            </div>
                        </div>

                        <div class="row m-b-10">
                            <div class="col-lg-6 m-b-10">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">身份证号</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=staff.getIdentity()%>">
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">银行卡号</button>
                                    </span>
                                    <input type="text" class="form-control" readonly  value="<%=staff.getBankcard()%>">
                                </div>
                            </div>
                        </div>


                        <div class="row m-b-10">
                            <div class="col-lg-12">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">家庭住址</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=staff.getStaffAddress()%>">
                                </div>
                            </div>
                        </div>

                        <div class="row m-b-10">
                            <div class="col-lg-4 m-b-10">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">性别</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=staff.getGender()%>">
                                </div>
                            </div>

                            <div class="col-lg-4 m-b-10">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">婚姻状态</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=staff.getMarriage()%>">
                                </div>
                            </div>
                            <div class="col-lg-4">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">家庭是否在南昌</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=staff.getFamily()%>">
                                </div>
                            </div>
                        </div>

                        <div class="row m-b-10">
                            <div class="col-lg-4 m-b-10">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">可用面积</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=room.getRoomEffectarea()%>">
                                </div>
                            </div>

                            <div class="col-lg-4 m-b-10">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">租用面积</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=room.getRoomRentarea()%>">
                                </div>
                            </div>
                            <div class="col-lg-4">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">公摊面积</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=room.getRoomPublicarea()%>">
                                </div>
                            </div>
                        </div>


                        <div class="row m-b-10">
                            <div class="col-lg-12">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">需要费用</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=cost*3%>元---(租用面积*房间单价+公摊面积*1)*3个月">
                                </div>
                            </div>
                        </div>

                        <div class="row m-b-10">
                            <div class="col-lg-9 ">
                                <div class="form-group">
                                    <span class="input-group-btn">
                                          <button class="btn btn-default" type="button">申请原因</button>
                                    </span>
                                </div>
                            </div>
                            <div class="col-lg-9" style="margin-top: -10px">
                                <textarea class="form-control"  rows="6" placeholder="<%=apply.getApplyReason()%>"></textarea>
                            </div>
                        </div>

                        <div class="row m-b-10">
                            <div class="col-lg-1">
                                <div class="form-group">
                                    <span class="input-group-btn">
                                          <button class="btn btn-default" type="button">申请状态</button>
                                    </span>
                                </div>
                            </div>
                            <div class="col-lg-1">
                                <%
                                    if(apply.getApplyState()==0){
                                %>
                                <button class="btn btn-warning btn-w-md" >等待审批</button>
                                <%
                                }else if(apply.getApplyState()==1){
                                %>
                                <button class="btn btn-success btn-w-md" >通过</button>
                                <%
                                }else {
                                %>
                                <button class="btn btn-danger btn-w-md" >取消</button>
                                <%
                                    }
                                %>

                            </div>


                        </div>

                        <input hidden="hidden" name="propertyId" value="<%=property.getPropertyId()%>">
                        <input hidden="hidden" name="estateId" value="<%=estate.getEstateId()%>">
                        <input hidden="hidden" name="buildId" value="<%=build.getBuildId()%>">
                        <input hidden="hidden" name="roomId" value="<%=room.getRoomId()%>">
                        <input hidden="hidden" name="bedId" value="<%=bed.getBedId()%>">
                        <input hidden="hidden" name="staffId" value="<%=staff.getStaffId()%>">

                        <div class="nav-step-button">
<%--                            <a class="btn btn-secondary" hidden="hidden" disabled="" data-wizard="prev" type="button" href="s_bed.jsp?room=<%=bed.getRoomId()%>">上一步</a>--%>
                            <a class="btn btn-secondary"
                                    <%
                                    if(apply.getApplyState()==-1){
                                     %>
                                    disabled
                                    <%}%>
                               href="/cancelApply" >撤销申请</a>
                            <button class="btn btn-secondary" data-wizard="next" type="submit">打印申请单</button>
                        </div>


                    </form>
                </div>
            </div>
        </div>

    </div>

</div>

<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/main.min.js"></script>
<!--向导插件-->
<script type="text/javascript" src="../js/jquery.bootstrap.wizard.min.js"></script>

</body>
</html>
